package ysq.xyg.sys.controller;

import cn.hutool.core.util.StrUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import ysq.xyg.base.controller.BaseController;
import ysq.xyg.base.model.dto.ReturnEntity;
import ysq.xyg.sys.model.po.SysLogLogin;
import ysq.xyg.sys.model.vo.SysLogLoginVo;
import ysq.xyg.sys.service.SysLogLoginService;

import javax.annotation.Resource;

/**
 * 系统部分-字典controller层
 *
 * @author shengQiang yu
 * @date 2019-3-28 16:42:01
 */
@RestController
public class SysLogLoginController extends BaseController {

    private static Logger log= LoggerFactory.getLogger(SysLogLoginController.class);
    @Resource
    private SysLogLoginService sysLogLoginService;

    private SysLogLogin sysLogLogin;

    /**
     * 分页查询
     *
     * @param sysLogLoginVo 对象
     * @param pageSize 展示数量
     * @param pageNum 当前页面
     * @author shengQiang yu
     * @date 2019-3-28 16:42:01
     */
    @RequestMapping(value = "/sysLogLogin/page",method = RequestMethod.POST)
    public ReturnEntity page(SysLogLoginVo sysLogLoginVo, int pageSize, int pageNum){
        ReturnEntity returnEntity = sysLogLoginService.page(sysLogLoginVo,pageSize,pageNum);
        return returnEntity;
    }

    /**
     * 跳转连接
     *
     * @param id 主键id
     * @author shengQiang yu
     * @date 2019-3-28 16:42:01
     */
    @RequestMapping(value = "/sysLogLogin/getEntity",method = RequestMethod.GET)
    public ModelAndView getEntity(String id){
        ModelAndView view = new ModelAndView("/sys/sysLogLoginUpdateOrSave");
        if(StrUtil.isNotEmpty(id)){
            sysLogLogin = sysLogLoginService.selectByPrimaryKey(id);
            view.addObject("sysLogLogin", sysLogLogin);
        }
        return view;
    }
}